package com.Test;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.Stack;

/**
 * Description:
 * Copyright:   Copyright (c)2019
 * Company:     zefu
 *
 * @author: 张李鑫
 * @version: 1.0
 * Create at:   2022-02-16 13:20:07
 * <p>
 * Modification History:
 * Date         Author      Version     Description
 * ------------------------------------------------------------------
 * 2022-02-16     张李鑫                     1.0         1.0 Version
 */
public class Queen {
    private Stack<Integer> stack = new Stack();
    private Stack<Integer> stackI = new Stack();

    public void push(int val) {
        stack.push(val);
    }

    public int pop() {
        Stack<Integer> cur = stack;
        Stack<Integer> next = stackI;
        while (cur.size() != 1) {
            next.push(cur.pop());
        }
        Integer res = cur.pop();
        while (!next.isEmpty()) {
            stack.push(stackI.pop());
        }
        return res;
    }


    public static void main(String[] args) {
        Queen queen = new Queen();
        new HashMap<>();
        LinkedList<Object> list = new LinkedList<>();
        for (int i = 0; i < 100; i++) {
            list.add(i);
            queen.push(i);
            if (i % 3 == 0) {
                System.out.println(queen.pop());
                System.out.println(list.pop());
            }
        }

    }
}
